package com.saifan.wyy_ov.utils;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;

import com.saifan.wyy_ov.R;

/**
 * @author Wangli
 * @Description:
 * @date: 2015/6/12 14:34
 * @version: V1.0
 */
public class CircleProgressBottomDialog {
    private static View view;
    private static PopupWindow popupWindow;

    public static void showDialog(Context context){
        if (popupWindow == null){
            view = LayoutInflater.from(context).inflate(R.layout.circleprogressdialog, null);
            popupWindow = new PopupWindow(view, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT, false);
        }
        popupWindow.showAtLocation(view, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, 0);
    }

    public static void closeDialog(){
       if (popupWindow != null){
           popupWindow.dismiss();
           popupWindow = null;
       }
    }
}
